Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use CurveStableSwapMetaNG contract #893

Merged
merged 9 commits into from
Feb 6, 2024

Conversation

@rndquu rndquu marked this pull request as ready for review February 5, 2024 16:50
@gitcoindev
Copy link
Contributor

Hi @rndquu I started the review, and did a quick scan first to get understanding of the changes. Since the pull request is big, it will take me some time to process. I will check the new curve implementation docs and go through the changes again tomorrow morning with a fresh brain and provide my feedback.

Copy link
Member

@molecula451 molecula451 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heavy refactor, looking clean, as far as I am concern, this new metapool fixes most of the issues that comes with recent findings on TWAP so it comes reloaded!

Copy link
Contributor

@gitcoindev gitcoindev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right! I needed a strong coffee. I am approving from my side as well.

My main takeaways noted during the review:

  • TWAPOracleDollar3poolFacet and IMetaPool removed in favor of ICurveStableSwapMetaNG

  • MockMetaPool is now MockCurveStableSwapMetaNG.

  • twapOracleDollar3PoolFacetImplementation is out, meaning one facet less to deploy. Curve metapool is now stored and fully managed in managerFacet.

  • Metapool layout is as before, Dollar token first (index 0), 3CRV token has index 1.

  • TWAP price for Dollar is now available as ICurveStableSwapMetaNG(store.stableSwapMetaPoolAddress).price_oracle(0);

// get Dollar price from Curve Metapool (18 decimals)
uint256 dollarPriceUsdD18 = LibTWAPOracle.getTwapPrice();
uint256 dollarPriceUsdD18 = ICurveStableSwapMetaNG(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pairing Dollar with the tripool will still cause this issue, even if the pool used is a StableSwapMetaNG and not the old curve pools.
Recommendation:
The best solution to achieve an actual peg to $1 would be to use Chainlink price feeds instead. or to pair Dollar with a different asset that is actually pegged to $1 rather than 3CRV, given that currently the pool price will tend to follow 3CRV's price, which currently trades at $1.03.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants